<?php
function generic_autoload($c) {
	$v = ltrim(preg_replace('#([A-Z])#', '/\1', $c), '/');
	if(!file_exists(FILE_ROOT.'/private/'.$v.'.php'))
		throw new SignalCmdUnknown($c);
	require_once $v.'.php';
	if(!class_exists($c, false))
		throw new SignalCmdUnknown($c);
}

function array_map_recursive($fn, $arr) {
	$rarr = array();
	foreach ($arr as $k => $v) {
		$rarr[$k] = is_array($v)
		? array_map_recursive($fn, $v)
		: $fn($v);
	}
	return $rarr;
}
